package cn.kgc.service.impl;

import cn.kgc.bean.pojo.CPost;
import cn.kgc.mapper.PostManagerMapper;
import cn.kgc.service.PostManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PostManagerServiceImpl implements PostManagerService {
    @Autowired
    private PostManagerMapper pmm;
    @Override
    public List<CPost> selectAll() {
        return pmm.selectAll();
    }

    @Override
    public boolean addPost(CPost cPost) {
        if (pmm.addPost(cPost) > 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean deletePostById(long id) {
        if (pmm.deletePostById(id) > 0){
            return true;
        }
        return false;
    }

    @Override
    public CPost selectAllById(long id) {
        return pmm.selectAllById(id);
    }

    @Override
    public boolean updatePost(CPost cPost) {
        if (pmm.updatePost(cPost) > 0 ){
            return true;
        }
        return false;
    }

    @Override
    public List<CPost> selectByName(String name) {
        return pmm.selectByName(name);
    }
}
